<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <script>
    const obj = {
      // 普通函数中，谁调用，this就指向谁
      handleHello() {
        console.log('handleHello----->', this);
      },
      // 箭头函数，不会创建自己的this，它只会从自己的作用域链的上一层继承 this
      handleHello2: () => {
        console.log('handleHello2----->', this);
      }
    }

    obj.handleHello() // this指向哪里？ obj
    obj.handleHello2()  // this指向哪里？ window
  </script>
</body>

</html>